package com.onlyphoto.onlymall.mvp.model

import com.onlyphoto.onlymall.api.Urls
import com.onlyphoto.onlymall.base.BaseEntity
import com.onlyphoto.onlymall.base.BaseModel
import com.onlyphoto.onlymall.base.BaseObserver
import com.onlyphoto.onlymall.bean.request.SmsBean
import com.onlyphoto.onlymall.bean.response.UserInfoBean
import com.onlyphoto.onlymall.utils.ConfigUtil
import com.onlyphoto.onlymall.utils.RxTransformer


class MLoginBySmsImpl : BaseModel() {
    var url = ""
    fun getVerify(getType: Int, phone: String, baseObserver: BaseObserver<Void>) {
        url = ConfigUtil.instance.getUrl(Urls.LOGIN)
        apiService().getVerify(url, getType, phone)
                .compose(RxTransformer.switchSchedulers(this))
                .subscribe(baseObserver)
    }

    fun loginBySms(bean: SmsBean, baseObserver: BaseObserver<UserInfoBean>) {
        url = ConfigUtil.instance.getUrl(Urls.LOGIN)
        apiService().loginBySms(url, bean.toMap())
                .compose(RxTransformer.switchSchedulers(this))
                .subscribe(baseObserver)
    }
}
